package com.loop.unclelend.ui.adapter

import androidx.recyclerview.widget.RecyclerView
import com.loop.unclelend.R
import com.loop.unclelend.utils.adapter.UncleRecyclerViewAdapter
import com.loop.unclelend.utils.adapter.UncleViewHolderHelper
import org.json.JSONObject

/**
 * UncleLend
 * @Author wwdeng
 * @CreateTime: 2024/9/9 16:14
 * @Annotation：菜单
 */
class Adapter_Menu(recyclerView: RecyclerView?) : UncleRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.uncle_item_menu) {

    override fun setItemChildListener(helper: UncleViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.layout_item) //点击Item
    }

    override fun fillData(helper: UncleViewHolderHelper, position: Int, model: JSONObject) {
        val imgMenuIcon = helper.getImageView(R.id.img_menu_icon)
        imgMenuIcon.setImageResource(model.optInt("menuIcon"))

        helper.setText(R.id.txt_menu_title,model.optString("menuTitle"))
        helper.setText(R.id.txt_menu_value,model.optString("menuValue"))
    }
}